package com.example.smart_hospital.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;



/**
 * @Author: YiRanCrazy@gmail.com
 * @Description: MinIo 配置类
 * @Version: 1.0
 * @DateTime: 2024/4/10 12:01
 **/


@Configuration
@EnableConfigurationProperties(MinioPropertiesConfig.class)
public class MinioConfig {
    @Autowired
    private MinioPropertiesConfig minioPropertiesConfig;    // minio 实体配置类


    /**
     * 初始化 MinIO 客户端
     */
    @Bean
    public MinioClient minioClient() {
        MinioClient minioClient = MinioClient.builder()
                .endpoint("http://47.113.146.82:9000")
                .credentials("yirancrazy", "dazhutizi")
                .build();
        return minioClient;
    }
}